package com.cloud.entity;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Henry.Song
 * @version 2020/11/26
 * @description
 */
public class ResultPageEntity extends ResultEntity {

    public List<JSONObject> getList() {
        if (getJSONArray("list") == null) {
            setList(new ArrayList<JSONObject>());
        }
        return getJSONArray("list").toJavaList(JSONObject.class);
        //return getObject("list", new TypeReference<List<JSONObject>>(){});
    }

    public void setList(List<JSONObject> list) {
        put("list", list);
    }

    public int getTotalCount() {
        return getIntValue("totalCount");
    }

    public void setTotalCount(int totalCount) {
        put("totalCount", Integer.valueOf(totalCount));
    }


    public int getTotalPage() {
        return getIntValue("totalPage");
    }

    public void setTotalPage(int totalPage) {
        put("totalPage", Integer.valueOf(totalPage));
    }
}
